package design.pattern.Strategy;

public enum Run {

    RUN_320("BWM320",new BMW320()),
    RUN_523("BMW523",new BMW523()),
    RUN_X5("BMWX5",new BMWX5());

    private String type;
    private Strategy strategy;

     Run(String type,Strategy strategy){
        this.type =type;
        this.strategy = strategy;
    }

    public static Strategy getStrategy(String type){
        for (Run value : Run.values()) {
            if (value.type.equals(type)){
                return value.strategy;
            }
        }
        return null;
    }

}
